Using "severity_based" urgency in "incident_urgency_rule" throws strange error

Hello, we are using terraform integration to set incident_urgency rules. We have the following setup

  resource "pagerduty_service" "tech_team_x" {
  name                    = "[${var.tech_label}] Team X"
  auto_resolve_timeout    = "null"
  acknowledgement_timeout = "null"
  escalation_policy       = pagerduty_escalation_policy.team_x.id
  alert_creation          = "create_alerts_and_incidents"

  incident_urgency_rule {
    type = "use_support_hours"
    urgency = "severity_based"
  }

  support_hours {
    days_of_week = [1, 2, 3, 4, 5, 6, 7]
    end_time     = "23:30:00"
    start_time   = "08:30:00"
    time_zone    = "America/New_York"
    type         = "fixed_time_per_day"
  }
}

The problem is we get this error:

Error: PUT API call to https://api.pagerduty.com/services/PUZ73WZ failed 400 Bad Request. Code: 2001, Errors: [Active urgency must be in high, low, or severity_based.], Message: Invalid Input Provided

which makes no sense since we are clearly setting urgency to severity_based.

We also tried the following variation:

  resource "pagerduty_service" "tech_team_x" {
  name                    = "[${var.tech_label}] Team X"
  auto_resolve_timeout    = "null"
  acknowledgement_timeout = "null"
  escalation_policy       = pagerduty_escalation_policy.team_x.id
  alert_creation          = "create_alerts_and_incidents"

  incident_urgency_rule {
     type = "use_support_hours"

     during_support_hours {
       type    = "constant"
       urgency = "severity_based"
     }

    outside_support_hours {
       type    = "constant"
       urgency = "severity_based"
     }
  }

  support_hours {
    days_of_week = [1, 2, 3, 4, 5, 6, 7]
    end_time     = "23:30:00"
    start_time   = "08:30:00"
    time_zone    = "America/New_York"
    type         = "fixed_time_per_day"
  }
}

and this doesn’t work either. Now I get

│ Error: PUT API call to https://api.pagerduty.com/services/PUZ73WZ failed 400 Bad Request. Code: 2001, Errors: [During support hours is invalid.], Message: Invalid Input Provided

Can someone please help? I believe the first one should have worked as per [docs] (https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/resources/service) but I am not sure what we’re doing wrong.

To be clear, ideally, we want the incident Urgency to be severity_based regardless of support_hours setup.

Hello Neha,

We would need some account specific details in order to troubleshoot this.

Please can you email support@pagerduty.com with details regarding the version of the PagerDuty Provider you are using and that of Terraform.
You may also what to have Terraform debug logging turned on too.
For the debug logging, set the TF_LOG environment variable to DEBUG. More details about that here then provide the output.

KInd regards,

Hi @neha.srivastava if what You trying to do is configuring incident_urgency_rule to severity_based, then You need to set type to constant, like follows…

resource "pagerduty_service" "tech_team_x" {
  name                    = "[${var.tech_label}] Team X"
  auto_resolve_timeout    = "null"
  acknowledgement_timeout = "null"
  escalation_policy       = pagerduty_escalation_policy.team_x.id
  alert_creation          = "create_alerts_and_incidents"

  incident_urgency_rule {
    type    = "constant"
    urgency = "severity_based"
  }

  # While incident_urgency_rule.type = constant support_hours config blocks cause invalid payloads for API calls, so it shouldnt be included
  # support_hours {
  # days_of_week = [1, 2, 3, 4, 5, 6, 7]
  # end_time     = "23:30:00"
  # start_time   = "08:30:00"
  # time_zone    = "America/New_York"
  # type         = "fixed_time_per_day"
  # }
}